package com.example.springbootweb.bean;

import com.example.springbootweb.interfaces.Foo;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Proxy;

/**
 * @author: wukangrong
 * @date: 2019/8/16 10:37
 * @description: 动态代理对原来接口的增强
 */
public class Test {

    public static void main(String[] args) {
        System.getProperties().put("sun.misc.ProxyGenerator.saveGeneratedFiles", "true");
        Foo f = (Foo) Proxy.newProxyInstance(Test.class.getClassLoader(), new Class[]{Foo.class}, new MyInvocationHandler(new Foos()));
        System.out.println(f.test("VoV"));
    }

}

